<?php require _APP_PATH_ . '/system/platform/resource/common_inc_header.tpl.php';?>

<span class="layui-breadcrumb">
    <a href="<?php echo url( _MODULE_NAME_ . '/admin.index/index');?>"><?php echo $GLOBALS['config']['module']['name'];?></a>
    <a href="<?php echo url([ _MODULE_NAME_ ,'admin/goods','index']);?>">商品</a>
    <a><cite>修改</cite></a>
</span>

<div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title">
        <li class="layui-this"><a href="<?php echo url([ _MODULE_NAME_ ,'admin.goods','index']);?>">商品</a></li>
    </ul>
</div>

<form class="layui-form" action="<?php echo url([ _MODULE_NAME_ ,'admin/goods','goods_save']);?>" method="post" style="max-width: 900px;margin: 40px auto;">
    <input type="hidden" name="id" value="<?php echo $ret['id'];?>">
    <div class="layui-form-item">
        <label class="layui-form-label">商品分类</label>
        <div class="layui-input-block">
            <select name="sort_id" lay-verType="tips" lay-verify="required" required>
                <?php
                foreach($rs_sort as $row){
                ?>
                <option value="<?php echo $row['sort_id'];?>" <?php if($row['sort_id']==$ret['sort_id']){echo 'selected';}?> ><?php 
                for($i=2;$i<substr_count($row['parent_path'],',');$i++){ echo '&nbsp; &nbsp; ├ ';}echo $row['sort_name'];
                ?></option>
                <?php
                }
                ?>
            </select>
        </div>
    </div>
    <br>
    <div class="layui-form-item">
        <label class="layui-form-label">商品标题：</label>
        <div class="layui-input-block">
            <input type="text" name="goods_name" placeholder="请输入商品标题" class="layui-input" value="<?php echo $ret['goods_name'];?>"
                    lay-verType="tips" lay-verify="required" required/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">属性：</label>
        <div class="layui-input-block">
            <input type="checkbox" name="flag[]" value="推荐" title="推荐" lay-skin="primary" <?php echo strpos($ret['flag'],'推荐')!==false?'checked':'';?> > 
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">简介：</label>
        <div class="layui-input-block">
            <input type="text" name="tip" placeholder="请输入简介" class="layui-input" lay-verType="tips" value="<?php echo $ret['tip'];?>" />
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">商品图片：</label>
        <div class="layui-input-block">
            <?php echo tpl_file_manager( [ 'goods_img', $ret['goods_img'] ] ); ?>
			<br style="clear:both">上传图片尺寸视网站效果自定
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">内容：</label>
        <div class="layui-input-block">
            <textarea id="content" name="content" hidden ><?php echo $ret['content'];?></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">关键字：</label>
        <div class="layui-input-block">
            <input type="text" name="keyword" placeholder="请输入关键字" class="layui-input" lay-verType="keyword"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">点击量：</label>
        <div class="layui-input-block">
            <input type="text" name="hits" placeholder="请输入点击量" class="layui-input" value="<?php echo $ret['hits'];?>"/>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">建立时间：</label>
            <div class="layui-input-inline" >
            <input type="text" name="create_time" id="create_time" placeholder="请输入时间" class="layui-input" value="<?php echo date('Y-m-d H:i:s',$ret['create_time'])?>"/>
            </div>
        </div>
        <div class="layui-inline">
            <label class="layui-form-label">修改时间：</label>
            <div class="layui-input-block">
                <input type="text" name="update_time" id="update_time" placeholder="请输入时间" class="layui-input" value="<?php echo date('Y-m-d H:i:s')?>"/>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">模板：</label>
        <div class="layui-input-block">
            <input type="radio" name="tpl_name" value="goods_detail.tpl.php" title="默认" <?php echo ($ret['tpl_name']=='goods_detail.tpl.php')? 'checked':''; ?> >
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">状态：</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="1" title="启用" <?php if($ret['status']=='1'){ echo 'checked';}elseif($ret['status']!='0'){ echo 'checked';}?> >
            <input type="radio" name="status" value="0" title="禁用" <?php if($ret['status']=='0'){ echo 'checked';}?> >
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" type="submit" lay-submit >&emsp;提交&emsp;</button>
        </div>
    </div>
</form>

<?php require _APP_PATH_ . '/system/platform/resource/common_inc_footer.tpl.php';?>

<script type="text/javascript" src="<?php echo _APP_URL_;?>/library/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="<?php echo _APP_URL_;?>/library/ueditor/ueditor.all.js"></script>
<script>
    var ue = UE.getEditor('content');
  //执行一个laydate实例
  layui.laydate.render({
    elem: '#create_time' //指定元素
    ,type: 'datetime'
  });
  layui.laydate.render({
    elem: '#update_time' //指定元素
    ,type: 'datetime'
  });
</script>
